{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>tickers</th>\n",
       "      <th>eps</th>\n",
       "      <th>revenue</th>\n",
       "      <th>price</th>\n",
       "      <th>people</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>GOOGL</td>\n",
       "      <td>27.82</td>\n",
       "      <td>87</td>\n",
       "      <td>845</td>\n",
       "      <td>larry page</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>WMT</td>\n",
       "      <td>4.61</td>\n",
       "      <td>484</td>\n",
       "      <td>65</td>\n",
       "      <td>n.a.</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>MSFT</td>\n",
       "      <td>-1</td>\n",
       "      <td>85</td>\n",
       "      <td>64</td>\n",
       "      <td>bill gates</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>RIL</td>\n",
       "      <td>not available</td>\n",
       "      <td>50</td>\n",
       "      <td>1023</td>\n",
       "      <td>mukesh ambani</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>TATA</td>\n",
       "      <td>5.6</td>\n",
       "      <td>-1</td>\n",
       "      <td>n.a.</td>\n",
       "      <td>ratan tata</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "  tickers            eps  revenue price         people\n",
       "0   GOOGL          27.82       87   845     larry page\n",
       "1     WMT           4.61      484    65           n.a.\n",
       "2    MSFT             -1       85    64     bill gates\n",
       "3    RIL   not available       50  1023  mukesh ambani\n",
       "4    TATA            5.6       -1  n.a.     ratan tata"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# pip install pandas\n",
    "import pandas as pd\n",
    "df = pd.read_excel('stock_data.xlsx')  # DataFrame\n",
    "df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>tickers</th>\n",
       "      <th>eps</th>\n",
       "      <th>revenue</th>\n",
       "      <th>price</th>\n",
       "      <th>people</th>\n",
       "      <th>lower_tickers</th>\n",
       "      <th>double_price</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>GOOGL</td>\n",
       "      <td>27.82</td>\n",
       "      <td>87</td>\n",
       "      <td>845</td>\n",
       "      <td>larry page</td>\n",
       "      <td>googl</td>\n",
       "      <td>1690</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>WMT</td>\n",
       "      <td>4.61</td>\n",
       "      <td>484</td>\n",
       "      <td>65</td>\n",
       "      <td>n.a.</td>\n",
       "      <td>wmt</td>\n",
       "      <td>130</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>MSFT</td>\n",
       "      <td>-1</td>\n",
       "      <td>85</td>\n",
       "      <td>64</td>\n",
       "      <td>bill gates</td>\n",
       "      <td>msft</td>\n",
       "      <td>128</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>RIL</td>\n",
       "      <td>not available</td>\n",
       "      <td>50</td>\n",
       "      <td>1023</td>\n",
       "      <td>mukesh ambani</td>\n",
       "      <td>ril</td>\n",
       "      <td>2046</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>TATA</td>\n",
       "      <td>5.6</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>ratan tata</td>\n",
       "      <td>tata</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "  tickers            eps  revenue  price         people lower_tickers  \\\n",
       "0   GOOGL          27.82       87    845     larry page         googl   \n",
       "1     WMT           4.61      484     65           n.a.           wmt   \n",
       "2    MSFT             -1       85     64     bill gates          msft   \n",
       "3    RIL   not available       50   1023  mukesh ambani          ril    \n",
       "4    TATA            5.6        0      0     ratan tata          tata   \n",
       "\n",
       "   double_price  \n",
       "0          1690  \n",
       "1           130  \n",
       "2           128  \n",
       "3          2046  \n",
       "4             0  "
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df['revenue'] = df['revenue'].replace(-1, 0)\n",
    "df['price'] = df['price'].replace('n.a.', 0)\n",
    "df['lower_tickers'] = df['tickers'].apply(lambda ticker: ticker.lower())\n",
    "df['double_price'] = df['price'] * 2\n",
    "df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [],
   "source": [
    "df.to_excel('new_stock.xlsx')"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.5.0"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
